import java.util.Arrays;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            String[] s = sc.nextLine().trim().split(" ");
            int len = s.length;
            int[] nums = new int[len];
            for (int i = 0; i < len; i++) {
                nums[i] = Integer.parseInt(s[i]);
            }
            System.out.println(Arrays.toString(fun(nums)));
        }
    }
    public static int[] fun(int[] arr) {
        int i = 0;
        while(i < arr.length) {
            if(arr[i] <= 0) {
                i++;
                continue;
            }
            if (arr[i] > 0) {
                int temp = arr[i] - 1;
                if (arr[temp] > 0) {
                    arr[i] = arr[temp];
                    arr[temp] = -1;
                } else {
                    arr[temp]--;
                    arr[i] = 0;
                }
            }
        }
    return arr;
    }
}
